package com.sena.engine;

import com.sena.engine.common.exception.SenaSnmpRunTimeException;
import com.sena.engine.snmp.base.SnmpTarget;
import com.sena.engine.snmp.builder.SnmpApiBuilder;
import com.sena.engine.snmp.entity.MibIfEntry;
import com.sena.engine.snmp.entity.MibSystem;

import java.io.IOException;

/**
 * @author seven
 * @create 2021-11-24 22:56
 **/
public class test {

    public static void main(String[] args) throws IOException, SenaSnmpRunTimeException {

       SnmpTarget snmpTarget =  SnmpTarget.builder().port(161).nodeIP("127.0.0.1").snmpVersion(1).readCommunity("public").build();
        //System.out.println(snmpTarget.toString());
       t1();
       t2();
    }



    public static void t1() throws IOException, SenaSnmpRunTimeException {
        SnmpTarget snmpTarget =  SnmpTarget.builder().port(161).nodeIP("127.0.0.1").snmpVersion(1).readCommunity("public").build();
        System.out.println(SnmpApiBuilder.buildSnmpApi().getMibObject(new MibSystem(),snmpTarget).toString());
    }

    public static void t2() throws SenaSnmpRunTimeException {
        SnmpTarget snmpTarget =  SnmpTarget.builder().port(161).nodeIP("127.0.0.1").snmpVersion(1).readCommunity("public").build();
        System.out.println(SnmpApiBuilder.buildSnmpApi().getAllTableData(MibIfEntry.class,snmpTarget).toString());
    }


}
